<template>
  <div p4 w="240px">
    <p>程序集</p>
    <div>
      <ElCheckbox v-for="item in GetAllBundles()" :label="item.title" style="display: block;"
        :model-value="oProject.modulesEnabled.includes(item.name)" @change="enableModule(item.name, $event as any)"
        :disabled="item.name === 'builtin'" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { GetAllBundles } from '~/models/pyBundles';
import { oProject } from '~/models/Project';

const counter = ref(0)
onActivated(() => {
  console.log('Hello');
})
function enableModule(moduleName: string, status: boolean) {
  const s = new Set(oProject.value.modulesEnabled)
  if (status) {
    s.add(moduleName)
  }
  else {
    s.delete(moduleName)
  }
  oProject.value.modulesEnabled = Array.from(s)
  console.log(oProject.value.modulesEnabled);
}
</script>